package com.example.shiyan.mapper;



import com.example.shiyan.entity.Student;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface StuMapper {
    @Insert("insert into student(no,name,sex,phone,qq) values (#{no},#{name},#{sex},#{phone},#{qq})")
    int create(Student student);

    @Select("select * from student where name like concat('%',#{name},'%')")
    List<Student>getByName(String hname);

    @Select("select *from student where id=#{id}")
    Student getByID(Integer id);

    @Delete("delete from student where id=#{id}")
    int deleteById(Integer id);

    @Select("select *from student")
    List<Student>getAllStudents();

    @Update("update student set no=#{no},name=#{name},sex=#{sex},phone=#{phone},qq=#{qq} where id=#{id}")
    int updateStu(Student stu);

}
